home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group97a.txt / 000113_icon-group-sender _Sat Apr 12 17:10:21 1997.msg < prev    next >
Internet Message Format  |  2000-09-20  |  2KB

  1. Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 14 Apr 1997 09:15:33 MST
  2. Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM)
  3.     id AA02722; Mon, 14 Apr 1997 09:15:32 -0700
  4. To: icon-group@cs.arizona.edu
  5. Date: Sat, 12 Apr 1997 17:10:21 +1000
  6. From: Stuart.Robinson@anu.edu.au (Stuart Robinson)
  7. Message-Id: <Stuart.Robinson-1204971710220001@asianstmg-203.anu.edu.au>
  8. Organization: ANU
  9. Sender: icon-group-request@cs.arizona.edu
  10. Subject: More on Records
  11. Errors-To: icon-group-errors@cs.arizona.edu
  12. Status: RO
  13. Content-Length: 940
  14.  
  15.  
  16. Suppose you want to scan through each line of a text looking for a
  17. particular type of word.  Roughly speaking, the first time you find it, it
  18. should go to one field of a record and the second time you find it, it
  19. should go to another field of the same record.  (The word will appear at
  20. most two times in a line, possibly not at all.)  How would you do it?
  21.  
  22. More concretely, if you have the following line
  23.  
  24. {T.p istam eCel 3{O stuK 1{A
  25.  
  26. and a record with four fields like the following
  27.  
  28. record[index1, arg1, index2, arg2]
  29.  
  30. how do you write code that would take the first word with "{" followed by
  31. "S", "A", or "O" and put it into arg1 and its accompanying number into
  32. index1 and then take the second word in the same line with "{" followed by
  33. "S", "A", or "O" and put it into arg2 and its accompanying number into
  34. index2, as below?
  35.  
  36. record[3, {O, 1, {A]
  37.  
  38. -- 
  39. Stuart Robinson <Stuart.Robinson@anu.edu.au>
  40. The Australian National University
  41.